﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
        <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
            AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="PessoaID" 
            DataSourceID="ObjectDataSource1">
            <Columns>
                <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" 
                    ShowSelectButton="True" />
                <asp:BoundField DataField="PessoaID" HeaderText="PessoaID" 
                    InsertVisible="False" ReadOnly="True" SortExpression="PessoaID" />
                <asp:BoundField DataField="Nome" HeaderText="Nome" SortExpression="Nome" />
                <asp:BoundField DataField="Email" HeaderText="Email" SortExpression="Email" />
                <asp:BoundField DataField="Endereco" HeaderText="Endereco" 
                    SortExpression="Endereco" />
                <asp:BoundField DataField="DataNascimento" HeaderText="DataNascimento" 
                    SortExpression="DataNascimento" />
                <asp:BoundField DataField="DataCadastro" HeaderText="DataCadastro" 
                    SortExpression="DataCadastro" />
                <asp:BoundField DataField="DataCadastro" DataFormatString="{0:d}" 
                    HeaderText="DataCadastro" SortExpression="DataCadastro" />
            </Columns>
        </asp:GridView>
        <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" 
            DeleteMethod="DeleteQuery" InsertMethod="InsertQuery" 
            OldValuesParameterFormatString="original_{0}" SelectMethod="GetData" 
            TypeName="MeusDadosTableAdapters.PessoaTableAdapter" UpdateMethod="UpdateQuery">
            <DeleteParameters>
                <asp:Parameter Name="Original_PessoaID" Type="Int32" />
            </DeleteParameters>
            <UpdateParameters>
                <asp:Parameter Name="Nome" Type="String" />
                <asp:Parameter Name="Email" Type="String" />
                <asp:Parameter Name="Endereco" Type="String" />
                <asp:Parameter Name="DataNascimento" Type="DateTime" />
                <asp:Parameter Name="DataCadastro" Type="DateTime" />
                <asp:Parameter Name="Original_PessoaID" Type="Int32" />
            </UpdateParameters>
            <InsertParameters>
                <asp:Parameter Name="Nome" Type="String" />
                <asp:Parameter Name="Email" Type="String" />
                <asp:Parameter Name="Endereco" Type="String" />
                <asp:Parameter Name="DataNascimento" Type="DateTime" />
                <asp:Parameter Name="DataCadastro" Type="DateTime" />
            </InsertParameters>
        </asp:ObjectDataSource>
        <asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" 
            DataKeyNames="PessoaID" DataSourceID="ObjectDataSource1" DefaultMode="Insert" 
            Height="50px" Width="125px">
            <Fields>
                <asp:BoundField DataField="PessoaID" HeaderText="PessoaID" 
                    InsertVisible="False" ReadOnly="True" SortExpression="PessoaID" />
                <asp:BoundField DataField="Nome" HeaderText="Nome" SortExpression="Nome" />
                <asp:BoundField DataField="Email" HeaderText="Email" SortExpression="Email" />
                <asp:BoundField DataField="Endereco" HeaderText="Endereco" 
                    SortExpression="Endereco" />
                <asp:BoundField DataField="DataNascimento" HeaderText="DataNascimento" 
                    SortExpression="DataNascimento" />
                <asp:BoundField DataField="DataCadastro" HeaderText="DataCadastro" 
                    SortExpression="DataCadastro" />
                <asp:CommandField ShowInsertButton="True" />
            </Fields>
        </asp:DetailsView>
    
    </div>
    </form>
</body>
</html>
